import { WorkID } from '../../types';
import { ReqJobCorrectParam, ReqRefuseParam, ReqRevisalParam } from '../../types/jobs/jobCorrect';
import { Prepare } from '../../types/prepare';
import fetch, { BaseResponse } from '../index';

/**
 * 获取用户列表
 * @returns Prepare
 */
export async function getPrepareLessons(workerId: WorkID): Promise<BaseResponse<Prepare>> {
  const { data } = await fetch.get<BaseResponse<Prepare>>('/xuefu/oaphone/correct/prep/info', { work_id: workerId });
  return data;
}

/**
 * 驳回
 * @returns {}
 */
export async function rejectHomework(param: ReqRefuseParam): Promise<BaseResponse<{}>> {
  const { data } = await fetch.post<BaseResponse<{}>>('/xuefu/oaphone/correct/save/reject', { ...param });
  return data;
}

/**
 * 驳回订正
 * @returns {}
 */
export async function rejectReviseHomework(param: ReqRefuseParam): Promise<BaseResponse<{}>> {
  const { data } = await fetch.post<BaseResponse<{}>>('/xuefu/oaphone/correct/revise/reject', { ...param });
  return data;
}

/**
 * 提交批改作业列表
 * @returns ResMenu
 */
export async function correctSave(param: ReqJobCorrectParam): Promise<BaseResponse<{}>> {
  const { data } = await fetch.post<BaseResponse<{}>>('/xuefu/oaphone/correct/save', { ...param });
  return data;
}

/**
 * 提交订正作业列表
 * @returns ResMenu
 */
export async function correctRevise(param: ReqRevisalParam): Promise<BaseResponse<{}>> {
  const { data } = await fetch.post<BaseResponse<{}>>('/xuefu/oaphone/correct/revise', { ...param });
  return data;
}
